<!DOCTYPE html>
<html>
<head>
<title>group edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../resources/css/styles.css" rel="stylesheet">
<link href="css/jquery-ui.css" rel="stylesheet">
<link href="../resources/css/datagrid.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
<script src="../resources/component/template.min.js"></script>
<script type="text/javascript" src="../resources/component/jquery.js"></script>
<script type="text/javascript" src="../resources/component/jquery.dataset.js"></script>
<script type="text/javascript" src="external/common.js"></script>
<script type="text/javascript" src="../resources/component/jquery.datagrid.js"></script>
<script type="text/javascript" src="../resources/component/jquery.datatree.js"></script>
<script type="text/javascript" src="../resources/component/jquery.dropdown.js"></script>
 
</head>
<body>
<div> 
	<div>
	<input type="button" name="add" value="增加" />
	<input type="button" name="save" value="保存"/>
	</div>
	<div class="datagrid" id="grouptree" style="position:absolute;top:30px;left:0;right:0;bottom:150px;">
		<table>
			<thead>
				<tr style="height: 10px;">
					<th>分组编号</th>
					<th>分组名称</th>
					<th>分组描述</th>
				</tr>
			</thead>
			<tbody></tbody>
			<tfoot></tfoot>
		</table>
	</div></div>
</body>
<script>
var groupJson ={
		sqlid : "1001",
		key : "oid",
		pageNo : 0,
		parentKey:"pid",
		rootId: "",
		handlePosition: 0,
		columns : [
					{field : "groupcode",cls:"txt-l",edit:{
						type:"text"
					}},
					{field : "groupname",cls:"txt-l",edit:{
						type:"text"
					}},
					{field : "groupdesc",cls:"txt-l",edit:{
						type:"text"
					}}
				  ]};
var grouptree = $("#grouptree").DataTree(groupJson); 
grouptree.open();

$("[name='add']").on("click",function(){
	var selected = grouptree.getSeleted()[0];
	var record ={pid:selected.oid};
	grouptree.dataset.addRecord(record);
	
});
/**
$("[name='remove']").on("click",function(){
	var records = grouptree.getSeleted();
	if(records.length > 0){
	    for (var i = 0; i < records.length; i++) {
	    	grouptree.dataset.deleteRecord(records[i]);
	    }; 
	}else{
		alert("请选择要删除的记录");
	}
});**/
$("[name='save']").on("click",function(){
	grouptree.dataset.save();
	grouptree.open();
});


</script>
</html>